﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace CaveArt.Util.ZenGraph
{
    public enum DataType
    {
        eNotDefined,
        eString,
        eNumber,
        eDateTime
    }

    public enum SeperaterType
    {
        eNotDefined,
        eComma = ',',
        eTab = '\t',
        eColon = ':',
        eSemiColon = ';'
    }

    public class DataColumn
    {
        public string Name;
        public DataType eType;
    }

    [Serializable]
    public class Configuration
    {
        private string name = string.Empty;
        private bool headerexist = true;
        private string timeformat = string.Empty;
        private char[] seperaters = ",".ToCharArray();
        private List<DataColumn> columns = new List<DataColumn>();

        public string Name
        {
            get { return name; }
            set 
            { 
                char[] invalid = Path.GetInvalidFileNameChars();
                if (value.IndexOfAny(invalid) >= 0)
                {
                    throw new InvalidDataException("Name should have a valid file name.");
                }
                else
                {
                    name = value;
                }
            }
        }

        public string TimeFormat
        {
            get { return timeformat; }
            set
            {
                timeformat = value;
            }
        }

        public bool HeaderExist
        {
            get { return headerexist; }
            set { headerexist = value; }
        }

        public char[] Seperaters
        {
            get { return seperaters; }
            set { seperaters = value; }
        }

        public List<DataColumn> Columns
        {
            get { return columns; }
            set { columns = value; }
        }
    }
}
